﻿function clickMystow(id){
	doStow(id,"del","");
	var temp = "[id='"+id+"']";
	var stow = $("input"+temp);
	$("li"+temp).remove();
	stow.attr("checked",false);
	stow.parent().css("background","");
}

function clickStow(id){
	var temp = "[id='"+id+"']";
	var stow = $("input"+temp);
	var temp = "[id='"+id+"']";
	var liObj = $("li"+temp);
	var tempId = liObj.attr("id");
	var tdObj = stow.parent();
	if(tempId!=undefined){
		clickMystow(tempId)
		tdObj.css("background","");
	}else{
		doStow(id,"add","");
		tdObj.css("background","#ebebeb");
		var liObj = "<li id='"+id+"' style=\"background:#ebebeb;\">"+tdObj.html()+"</li>";
		$("#itemListUl").prepend(liObj);
		$($("li"+temp+" input")).click(function(){clickMystow(id);}).attr("checked",true);
	}
}

function doStow(id,act,info){	
	var ids = id.split("_");
	var len = ids.length;
	if(len>0){
		var uuid = ids[len-1];
		$.get(_userContextPath+"/UserFig_"+act+".htm",{"uuid":uuid,"random":Math.random()},function(data){
			if(data.indexOf("login.html")>-1){
				document.write(data);
			}else if(data.indexOf("成功")){
				if(info!=""){alert(info);}
			}else{
				alert(data);
			}
		});
	}
}
